package com.titanrise.crm.controller.root;

import com.titanrise.crm.environment.annotation.Autowired;
import com.titanrise.crm.environment.annotation.Controller;
import com.titanrise.crm.environment.annotation.FunctionConfig;
import com.titanrise.crm.environment.menu.action.Action;
import com.titanrise.crm.service.RootService;

/**
 * @Description:
 * @Author: pront
 * @Time:2024-11-06 16:37
 */
@Controller(basePath = "/root/api")
public class RootAPIController {

//    TODO 线程拿到root信息
    @Autowired
    private RootService rootService;

    @FunctionConfig(path = "/manageTradeInfo", key = 1, description = "删除交易信息", divider = "")
    private Action deleteTrade() {
        return rootService.deleteTrade();
    }

    @FunctionConfig(path = "/manageTradeInfo", key = 2, description = "查看销售业绩表", divider = "")
    private Action salsPerformance() {
        return rootService.tradeTable();
    }

    @FunctionConfig(path = "/manageTradeInfo", key = 3, description = "导出交易数据", divider = "")
    private Action exportTradeData() throws InterruptedException {
        return rootService.exportTradeData();
    }

    @FunctionConfig(path = "/manageTradeInfo", key = 4, description = "退出", divider = "")
    private Action exitTradePage() {
        return Action.JUMP_TO_MENU("/root");
    }

    @FunctionConfig(path = "/manageMemberInfo", key = 1 ,description = "修改用户账户密码", divider = "")
    private Action updateUsnaPasByNo(){
        return rootService.updateUsnaPasByNo();
    }

    @FunctionConfig(path = "/manageMemberInfo", key = 2 ,description = "新增销售人员", divider = "")
    private Action addSalesperson(){
        return rootService.addSalesperson();
    }

    @FunctionConfig(path = "/manageMemberInfo", key = 3 ,description = "删除成员", divider = "")
    private Action deleteSalesperson(){
        return rootService.deleteSalesperson();
    }

    @FunctionConfig(path = "/manageMemberInfo", key = 4 ,description = "退出", divider = "")
    private Action exitRootPage(){
        return Action.JUMP_TO_MENU("/root");
    }

    @FunctionConfig(path = "/manageClientInfo", key = 1, description = "查看客户所属销售", divider = "")
    private Action showSalespersonOfClient(){
        return rootService.showSalespersonOfClient();
    }

    @FunctionConfig(path = "/manageClientInfo", key = 2, description = "分配客户", divider = "")
    private Action distributeClient(){
        return rootService.distributeClient();
    }

    @FunctionConfig(path = "/manageClientInfo", key = 3, description = "发送消息给销售", divider = "")
    private Action sendMsgToSalesperson(){
        return rootService.sendMsgToSalesperson();
    }

    @FunctionConfig(path = "/manageClientInfo", key = 4, description = "退出", divider = "")
    private Action exitClientPage(){
        return Action.JUMP_TO_MENU("/root");
    }


}
